package com.noble.meether.logic.media;


import android.os.Parcel;
import android.os.Parcelable;

import com.noble.library.base.bean.BaseData;

import org.json.JSONObject;

/**
 * 上传文件： 语音，图片及视频
 */
public class UpLoadResult extends BaseData implements Parcelable{

    private String uploadUrl;      // 上传文件地址

	// ---------- 暂时无用字段 -----------
	/**语音**/
	private String amr;//amr的存储路径
	private String mp3;//mp3的存储路径

	/**图片**/
	private String httpPathPic; //图片http链接地址

	/**视频**/
	private String thumb; //略缩图地址
	private String video; //视频地址

	@Override
	public void parseJson(String jsonStr) {
		JSONObject jsonObject = getJsonObject(jsonStr);
		this.setUploadUrl(jsonObject.optString("Url"));

//		// ---------- 小友 -----------
//		// 语音
//		if(!jsonObject.isNull("amr")){
//			this.setAmr(jsonObject.optString("amr"));
//		}
//		if(!jsonObject.isNull("mp3")){
//			this.setMp3(jsonObject.optString("mp3"));
//		}
//
//		// 视频
//		if(!jsonObject.isNull("thumb")){
//			this.setThumb(jsonObject.optString("thumb"));
//		}
//		if(!jsonObject.isNull("video")){
//			this.setVideo(jsonObject.optString("video"));
//		}
	}

    public String getUploadUrl() {
        return uploadUrl;
    }

    public void setUploadUrl(String uploadUrl) {
        this.uploadUrl = uploadUrl;
    }


	// ========================== 暂时无用 ====================
	public String getAmr() {
		return amr;
	}

	public void setAmr(String amr) {
		this.amr = amr;
	}

	public String getMp3() {
		return mp3;
	}

	public void setMp3(String mp3) {
		this.mp3 = mp3;
	}

	public String getThumb() {
		return thumb;
	}

	public void setThumb(String thumb) {
		this.thumb = thumb;
	}

	public String getVideo() {
		return video;
	}

	public void setVideo(String video) {
		this.video = video;
	}

    public UpLoadResult() {
	}

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.uploadUrl);
        dest.writeString(this.amr);
        dest.writeString(this.mp3);
        dest.writeString(this.httpPathPic);
        dest.writeString(this.thumb);
        dest.writeString(this.video);
    }

    protected UpLoadResult(Parcel in) {
        this.uploadUrl = in.readString();
        this.amr = in.readString();
        this.mp3 = in.readString();
        this.httpPathPic = in.readString();
        this.thumb = in.readString();
        this.video = in.readString();
    }

    public static final Creator<UpLoadResult> CREATOR = new Creator<UpLoadResult>() {
        @Override
        public UpLoadResult createFromParcel(Parcel source) {
            return new UpLoadResult(source);
        }

        @Override
        public UpLoadResult[] newArray(int size) {
            return new UpLoadResult[size];
        }
    };
}